import sys,os
sys.path.append(os.path.join(os.getcwd()))
from tool.config import config
from flask import Flask
from flask_jwt_extended import JWTManager
import os
import tool.db.sqlOp as sqlOp
from views.auth.auth import auth_bp
from views.filesys.filesys import fs_bp

config = config.get_sync_config()

app = Flask(__name__)
app.register_blueprint(auth_bp)
app.register_blueprint(fs_bp)
app.config["JWT_SECRET_KEY"] = config["FILE_SYSTEM"]["JWT_SECRET_KEY"]  # 应使用更安全的密钥
jwt = JWTManager(app)

os.makedirs(config["FILE_SYSTEM"]["UPLOAD_FOLDER"], exist_ok=True)


if __name__ == "__main__":
    sqlOp.init_db()
    app.run(debug=True,host="0.0.0.0",port="5002")